"""
用户相关模型
"""
from pydantic import BaseModel
from typing import Optional, Literal

class LoginRequest(BaseModel):
    """登录请求"""
    username: str
    password: str

class TokenData(BaseModel):
    """令牌数据"""
    username: str
    user_id: int

class UserSchema(BaseModel):
    """用户信息模式"""
    id: int
    username: str
    name: Optional[str] = None
    email: Optional[str] = None
    role: Literal["admin", "user"] = "user"
    avatar: Optional[str] = None

class LoginResponse(BaseModel):
    """登录响应"""
    token: str
    user: UserSchema
    expiresIn: int